//
//  UILable+Extension.swift
//  Weibo
//
//  Created by 孙明海 on 16/1/24.
//  Copyright © 2016年 孙明海. All rights reserved.
//

import UIKit

extension UILabel {
    convenience init(title: String, fontSize: CGFloat = 14, color: UIColor = UIColor.darkGrayColor(), screenInset: CGFloat = 0) {
        self.init()
        text = title
        font = UIFont.systemFontOfSize(fontSize)
        textColor = color

        numberOfLines = 0
        
        if screenInset == 0 {
            textAlignment = .Center
        } else {
            textAlignment = .Left
            preferredMaxLayoutWidth = UIScreen.mainScreen().bounds.width - 2 * screenInset
        }
    }
}
